package cn.highedu.test;

import javax.activation.MimetypesFileTypeMap;
import java.io.File;

public class MimeTypeDemo {
    public static void main(String[] args) {
        MimetypesFileTypeMap typeMap = new MimetypesFileTypeMap();
        File file1 = new File("demo.html");
        System.out.println(typeMap.getContentType(file1));
        File file2 = new File("test.jpg");
        System.out.println(typeMap.getContentType(file2));
        File file3 = new File("test.gif");
        System.out.println(typeMap.getContentType(file3));
        File file4 = new File("test.png");
        System.out.println(typeMap.getContentType(file4));
        File file5 = new File("test.docx");
        System.out.println(typeMap.getContentType(file5));
    }
}

